package com.atguigu.spzx.common.handler.exception;

import com.atguigu.spzx.model.result.ResultCodeEnum;
import lombok.Getter;

@Getter
public class SpzxException extends RuntimeException{
    private Integer code; //希望返回的 Result的code值
    private String message;//希望返回的 Result的message值
    private Throwable e; //代码中真正出现的异常
    public SpzxException(ResultCodeEnum codeEnum){
        this(codeEnum.getCode(), codeEnum.getMessage());
    }
    public SpzxException(ResultCodeEnum codeEnum,Throwable e){
        this(codeEnum.getCode(), codeEnum.getMessage(),e);
    }
    public SpzxException(Integer code , String message ){
        this.code = code;
        this.message = message;
    }
    public SpzxException(Integer code , String message , Throwable e){
        this.code = code;
        this.message = message;
        this.e = e;
    }
}
